<?php

/*
 * Copyright 2008 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#namespace tehframework\routing;

#use tehframework\events\EventArgs;
#use tehframework\request\Request;
#use tehframework\response\Response;

class RouteMatchResultEventArgs implements EventArgs
{
	/**
	 * @var Route::RESULT_*
	 */
	protected $result;
	
	/**
	 * @var Route
	 */
	protected $route;
	
	/**
	 * @var Request
	 */
	protected $request;
	
	/**
	 * @var Response
	 */
	protected $response;
	
	/**
	 * @param  Route::RESULT_* $result
	 * @param  Route $route
	 * @param  Request $request
	 * @param  Response $response
	 */
	public function __construct(
		$result, Route $route, Request $request, Response $response)
	{
		$this->result   = $result;
		$this->route    = $route;
		$this->request  = $request;
		$this->response = $response;
	}
	
	/**
	 * @return Route::RESULT_*
	 */
	public function getResult()
	{
		return $this->result;
	}
	
	/**
	 * @param  Route::RESULT_* $result
	 * @return RouteMatchResultEventArgs
	 */
	public function setResult($result)
	{
		$this->result = $result;
		
		return $this;
	}
	
	/**
	 * @return Route
	 */
	public function getRoute()
	{
		return $this->route;
	}
	
	/**
	 * @return Request
	 */
	public function getRequest()
	{
		return $this->request;
	}
	
	/**
	 * @return Response
	 */
	public function getResponse()
	{
		return $this->response;
	}
}